#include <bits/stdc++.h>
using namespace std;
const int N=1e5+50;
int a[N],p[N];
int n,s;
int main(void){
    while(~scanf("%d%d",&n,&s)){
        memset(a,0,sizeof(a));
        memset(p,0,sizeof(p));
        for(int i=1;i<=n;i++){
            scanf("%d",&a[i]);
            p[i]=p[i-1]+a[i];
        }
        int ans=1e9+50;
        //枚举终点,二分查找起点
        for(int i=1;i<=n;i++){
            int k=lower_bound(p,p+i,p[i]-s)-p;
            if(k>0){
                ans=min(ans,i-k+1);
            }
        }
        if(ans==1e9+50){
            ans=0;
        }
        printf("%d\n",ans);
    }
    return 0;
}